f2c28ff8b4fc125bc5eb12c7d384dee7ebb39797,source/com/intellij/openapi/diff/impl/patch/FilePatch.java,FilePatch,findFileToPatchByName,#VirtualFile#number#String#,145

Before Change


    VirtualFile fileToPatch = patchedDir;
    int lastComponentToFind = isNewFile() ? pathNameComponents.length-1 : pathNameComponents.length;
    for(int i=skipTopDirs; i<lastComponentToFind; i++) {
      fileToPatch = fileToPatch.findChild(pathNameComponents [i]);
      if (fileToPatch == null) {
        break;
      }

After Change


    VirtualFile fileToPatch = patchedDir;
    int lastComponentToFind = isNewFile() ? pathNameComponents.length-1 : pathNameComponents.length;
    for(int i=skipTopDirs; i<lastComponentToFind; i++) {
      VirtualFile nextChild = fileToPatch.findChild(pathNameComponents [i]);
      if (nextChild == null) {
        if (createDirectories) {
          try {
            nextChild = fileToPatch.createChildDirectory(this, pathNameComponents [i]);
          }
          catch (IOException e) {
            return null;
          }
        }
        else {
          return null;
        }
      }
      fileToPatch = nextChild;